<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta charset="UTF-8">
	<title>修改用户</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

 <!-- 新模板 -->
<link rel="shortcut icon" href="<c:url value='/template/new_muban/images/favicon.ico'/>" type="image/x-icon"/>

<!-- 最新导入 -->
<script type="text/javascript" src="<c:url value='/template/lead_into/js/jquery-3.3.1.js'/>"></script>
<link rel="stylesheet" href="<c:url value='/template/new_muban/css/font.css'/>">
<link rel="stylesheet" href="<c:url value='/template/new_muban/css/xadmin.css'/>">   
<script src="<c:url value='/template/new_muban/lib/layui/layui.js'/>" charset="utf-8"></script> 
<script type="text/javascript" src="<c:url value='/template/new_muban/js/xadmin.js'/>"></script>

 <!-- 富文本编辑器 -->
<script type="text/javascript" charset="utf-8" src="<c:url value='/ue/ueditor.config.js'/>"></script>
<script type="text/javascript" charset="utf-8" src="<c:url value='/ue/ueditor.all.js'/>"> </script>

<style type="text/css">
	/*圆形头像  */
	/* #divcss5{ margin:10px auto}  */
	#divcss5 img{ border-radius:50%} 
	.x-so input.layui-input {
    	width: 150px;
	}
</style>
<style>
.layui-upload-img {
	width: 92px;
	height: 92px;
	margin: 0 10px 10px 0;
}
</style>
<style type="text/css">
.uploader-list {
	margin-left: -15px;
}

.uploader-list .info {
	position: relative;
	margin-top: -25px;
	background-color: black;
	color: white;
	filter: alpha(Opacity = 80);
	-moz-opacity: 0.5;
	opacity: 0.5;
	width: 100px;
	height: 25px;
	text-align: center;
	display: none;
}

.uploader-list .handle {
	position: relative;
	background-color: black;
	color: white;
	filter: alpha(Opacity = 80);
	-moz-opacity: 0.5;
	opacity: 0.5;
	width: 100px;
	text-align: right;
	height: 18px;
	margin-bottom: -18px;
	display: none;
}

.uploader-list .handle i {
	margin-right: 5px;
}

.uploader-list .handle i:hover {
	cursor: pointer;
}

.uploader-list .file-iteme {
	margin: 12px 0 0 15px;
	padding: 1px;
	float: left;
}

.layui-form-label {
    float: left;
    display: block;
    padding: 9px 15px;
    width: 90px;
    font-weight: 400;
    line-height: 20px;
    text-align: right;
}
</style>
</head>
<body>
   
     <div class="x-body">
     
     
         <form class="layui-form"> 
 
  <%-- <div class="layui-form-item">
      <label class="layui-form-label">绑定人员</label>
      <div class="layui-input-inline">
        <select name="modules" id="member_id" lay-verify="required" lay-search="">
          <option value="">直接选择或搜索选择</option>
          
          <c:forEach items="${allUser}" var="mm">
           <option value="${mm.member_id}">${mm.nickname}(${mm.mobile})</option>
          </c:forEach>
          
        </select>
      </div>
    </div> --%>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>姓名
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="u_name" name="u_name" value="${userDetails.u_name}"  placeholder="请输入姓名" maxlength="15" required="" lay-verify="required"
                  autocomplete="off" class="layui-input">
              </div>
          </div>
         <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>手机号
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="u_phone" name="u_phone" value="${userDetails.u_phone}" placeholder="请输入手机号"  required="" lay-verify="required"
                  autocomplete="off" class="layui-input"  onkeyup="this.value=this.value.replace(/\D/g,'');">
              </div>
          </div>
            <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                所属单位
              </label>
              <div class="layui-input-inline" style="width: 300px;">
                  <input type="text" id="u_idc" name="u_idc" value="${userDetails.u_idc}" placeholder="请输入所属单位" 
                  autocomplete="off" class="layui-input">
              </div>
          </div>
          
           <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                地区
              </label>
              <div class="layui-input-inline" style="width: 300px;">
                  <input type="text" id="u_address" name="u_address" value="${userDetails.u_address}" placeholder="请输入地区" 
                  autocomplete="off" class="layui-input">
              </div>
          </div>
          
        <%--     <div class="layui-form-item">
              <label for="username" class="layui-form-label">
               座次
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="u_zc" name="u_zc" value="${userDetails.u_zc}"   placeholder="请输入座次" 
                  autocomplete="off" class="layui-input">
              </div>
          </div> --%>
          
          
          
          
           <div class="layui-form-item">
              <label for="username" class="layui-form-label">
               会议及座次
              </label>
              <div class="layui-input-block">
              	<table  id="tttttable" lay-filter="test3">
						
						</table>
	                 <%-- <table class="layui-table" lay-data="{url:'<c:url value='/selectAllFairJson.do'/>', id:'test3', escape: true}" lay-filter="test3">
						  <thead>
						    <tr>
						      <th lay-data="{type:'checkbox',templet: '#isChecked'}">会议ID</th>
						      <th lay-data="{field:'f_id', width:80}">会议ID</th>
						      <th lay-data="{field:'f_title', width:300}">会议</th>
						      <th lay-data="{field:'si_zc', edit: 'text', width:150}">会议座次</th>
						    </tr>
						  </thead>
						</table> --%>
              </div>
          </div> 
          
          
          
          
          
          
              	<c:if test="${userHotel != null && fn:length(userHotel) > 0}">
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                当前酒店房间
              </label>
              <div class="layui-input-block">
              	<c:forEach items="${userHotel}" var="hh" varStatus="index">
                  <input type="radio" name="hh_dq" value="${hh.hr_id}" title="${hh.hrn_name}(${hh.hb_bed})" <c:if test="${index.index+1 == 1}">checked</c:if>  />              	
              	</c:forEach>
              </div>
          </div>
              	</c:if>
        <div class="layui-form-item">
              <label for="username" class="layui-form-label">
               	空闲酒店房间
              </label>
              <div class="layui-input-block">
              	<c:forEach items="${allHotelByStatus}" var="hs">
                  <input type="radio" name="hs_hr_id" value="${hs.hr_id}" title="${hs.hrn_name}(${hs.hr_room}-<c:if test="${hs.hr_type == 1}">学员</c:if><c:if test="${hs.hr_type == 2}">销售</c:if>-<c:if test="${hs.hr_sex == 1}">男</c:if><c:if test="${hs.hr_sex == 2}">女</c:if> 入住人数${hs.hr_status})" />              	
              	</c:forEach>
              </div>
          </div>  
          
    <%--        <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                 就餐地点
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="u_eat_address" name="u_eat_address" value="${userDetails.u_eat_address}" placeholder="请输入就餐地点" 
                  autocomplete="off" class="layui-input">
              </div>
          </div> --%>
          
     <%--   <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                 酒店
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="u_hotel" name="u_hotel"  placeholder="请输入酒店"  value="${userDetails.u_hotel}" 
                  autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                 酒店类型
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="u_hoteltapy" name="u_hoteltapy"  placeholder="请输入酒店类型"  placeholder="请输入酒店类型"  value="${userDetails.u_hoteltapy}" 
                  autocomplete="off" class="layui-input">
              </div>
          </div> --%>
      <%--       
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                 酒店房号
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="u_hotelnumber" name="u_hotelnumber"  placeholder="请输入酒店房号"  value="${userDetails.u_hotelnumber}" 
                  autocomplete="off" class="layui-input">
              </div>
          </div> --%>
          
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>性别
              </label>
              <div class="layui-input-inline">
                  <input type="radio" name="u_sex" value="1" title="男"  <c:if test="${userDetails.u_sex == 1}">checked</c:if>>
                	<input type="radio" name="u_sex" value="2" title="女" <c:if test="${userDetails.u_sex == 2}">checked</c:if> >
              </div>
          </div>
 
    <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>类型
              </label>
              <div class="layui-input-inline">
                  <input type="radio" name="u_type" value="1" title="学员"  <c:if test="${userDetails.u_type == 1}">checked</c:if>>
                	<input type="radio" name="u_type" value="2" title="销售" <c:if test="${userDetails.u_type == 2}">checked</c:if>>
              </div>
          </div>
          
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <button  class="layui-btn" id="ttes" lay-filter="add" lay-submit="">
              修改
              </button>
          </div>
      </form>
    </div>
    <script>
    
  //table数据
    var tableData = ""; 
   // tableData = "${userBindFairStr}".split(',');
     tableData = '${userBindFairJson}';
   var user_obj = eval("("+tableData+")");
   
   console.log("user_obj : "+user_obj);
   
   tableData = user_obj;
   
   
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
        //执行一个laydate实例
        laydate.render({
      	  type: 'time'
      		    ,format: 'HH:mm:ss'
          ,elem: '#end_time' //指定元素
        });
      });
        layui.use(['form','layer'], function(){
            $ = layui.jquery;
          var form = layui.form
          ,layer = layui.layer;
          
          
          
        
          //自定义验证规则
          form.verify({
            nikename: function(value){
              if(value.length < 5){
                return '昵称至少得5个字符啊';
              }
            }
            ,pass: [/(.+){6,12}$/, '密码必须6到12位']
            ,repass: function(value){
                if($('#L_pass').val()!=$('#L_repass').val()){
                    return '两次密码不一致';
                }
            }
          });

          var flag = "A";
          form.on('radio(ho_type)', function(data){
			    //console.log(data.elem); //得到radio原始DOM对象
			    console.log(data.value); //被点击的radio的value值
			     if(data.value==0){
			     	    flag = "B";
			     }
			   
			     
			}); 
          
          var ho_bx_flag = "A";
          form.on('radio(ho_bx)', function(data){
			    //console.log(data.elem); //得到radio原始DOM对象
			    console.log(data.value); //被点击的radio的value值
			     if(data.value==1){
			    	 ho_bx_flag = "B";
			     }
			   
			     
			}); 

          
          
          
          //监听提交
          form.on('submit(add)', function(data){
           var u_id = "${userDetails.u_id}"
           //用户id
             var u_name = $("#u_name").val();
             var u_phone = $("#u_phone").val();
           // var u_hotel = $("#u_hotel").val();
           //  var u_eat_address = $("#u_eat_address").val();
             //var u_hoteltapy = $("#u_hoteltapy").val();
           //  var u_hotelnumber = $("#u_hotelnumber").val();
           
             var u_sex = $('input[name="u_sex"]:checked').val();
           
        	 if(u_sex == null || u_sex == ''){
        		 layer.msg('请选择性别!',{icon: 2,time:3000});      
                 return false;
        	 }
        	 var u_address = $("#u_address").val();
        	 
        	 
       	  //var u_zc = $("#u_zc").val();
       	 var u_idc = $("#u_idc").val();
       	 var u_type = $('input[name="u_type"]:checked').val();
       	 
       	var hs_hr_id = $('input[name="hs_hr_id"]:checked').val();
       	
    	var hh_dq = $('input[name="hh_dq"]:checked').val();
  
    	
  	  //选择会议
  	  if(tableData != null && tableData != ''){
  		  console.log("tableData : "+tableData);
  		  
  		  for(var i=0;i<tableData.length;i++){
			    var si_zc = tableData[i].si_zc;
				if(si_zc == null || si_zc == ''){
					layer.msg('请输入所选会议的座次!',{icon: 2,time:3000});      
                  return false;
				}
  		  }

  		  tableData = JSON.stringify(tableData); //将该数组封装成JSNO
  		  //tableData = tableData.toString()
  	  }else{
  		  console.log("tableData----------- : "+tableData);
  		  layer.msg('请选择会议!',{icon: 2,time:3000});      
            return false;
  	  }

  	  
  	  
        	//return false;
        //,"u_hotel":u_hotel,"u_hoteltapy":u_hoteltapy,"u_hotelnumber":u_hotelnumber
      // 	,"u_eat_address":u_eat_address
        $.ajax({
	                type: 'POST',
	                url: "<c:url value='/updateUser.do'/>",
			     	async : false, // 注意此处需要yi步  
		    		data: {
		 	   			"u_id":u_id,"u_name":u_name,"u_phone":u_phone,"u_sex":u_sex
		 	   		
		 	   		,"u_type":u_type
		 	   	,"u_idc":u_idc,"hs_hr_id":hs_hr_id,"hh_dq":hh_dq,"tableData":tableData
		 	   	,"u_address":u_address
		    		},
			        success: function(data){		
						if (data == 0) {
		             	   layer.msg('修改失败!',{icon: 2,time:3000});      
		                    return false;
		                } else if (data == 2) {
			             	   layer.msg('修改失败,手机号码已存在!',{icon: 2,time:3000});      
			                    return false;
			                } else if(data ==1)  {
		
		                	  layer.msg("修改成功", {icon: 6,time:1000},function () {
		                          // 获得frame索引
		                          var index = parent.layer.getFrameIndex(window.name);
		                          //alert(index);
		                          //关闭当前frame
		                          parent.layer.close(index);
		                          //重新加载父页面
		                          parent.location.reload();
		                      });
				           }
	             
	                }
				});
        	
            return false;
          });
          
          
        });
    </script>
     <script type="text/javascript">
//小数验证
	function clearNoNum(obj){  
     //修复第一个字符是小数点 的情况.  
     if(obj.value !=''&& obj.value.substr(0,1) == '.'){  
         obj.value="";  
     }  
     obj.value = obj.value.replace(/^0*(0\.|[1-9])/, '$1');//解决 粘贴不生效  
     obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符  
     obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的       
     obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");      
     obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数       
     if(obj.value.indexOf(".")< 0 && obj.value !=""){//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额  
         if(obj.value.substr(0,1) == '0' && obj.value.length == 2){  
             obj.value= obj.value.substr(1,obj.value.length);      
         }  
     }      
 }    
 </script>  
 
<script type="text/javascript">
//多图容器 【注册全局变量】
var images = [];

layui.use('upload', function(){
	  var $ = layui.jquery
	  ,upload = layui.upload;

	//多图片上传
	var uploadInst = upload.render({
		elem: '#test2'
            ,url: "<c:url value='/uploadToQiNiu.do'/>"
            ,multiple: true
            ,before: function(obj){
                layer.msg('图片上传中...', {
                    icon: 16,
                    shade: 0.01,
                    time: 0
                })
            }
            ,done: function(res){
            	//console.log(res);
            	//console.log(res.file_url);
                layer.close(layer.msg());//关闭上传提示窗口
                var title = res.file_url;
                var i1 = title.lastIndexOf("_"); //3
                title = title.substr(i1 +1);
                
                if ($(".file-iteme").length >=5) {
            		return layer.msg('上传图片不能多于5张！');
				  }else{
					  
	                //上传完毕
	                $('#uploader-list').append(
	                    '<div id="" class="file-iteme">' +
	                    '<div class="handle"><i class="layui-icon layui-icon-delete"></i></div>' +
	                    '<img style="width: 100px;height: 100px;" src='+ res.file_url +'>' +
	                    '<div class="info">' + title + '</div>' +
	                    '</div>'
	                    
	                );
	                  //追加图片成功追加文件名至图片容器
	                    images.push(res.file_url);
				 }
                
            }
	});
	
	
	
	
	
	
	/* 单图  */
	 upload.render({
		    elem: '#s_image_btn'
	 	   ,url: '<%=request.getContextPath()%>/uploadToQiNiu.do'
	 	   ,auto:true
	 	,size: 1024//限制文件大小，单位 KB
	 	   ,exts: 'jpg|png'
	 	   ,xhr:xhrOnProgress
	 	   ,progress:function(value){//上传进度回调 value进度值
	 	     console.log(value);
	 	     element.progress('demo', value+'%')//设置页面进度条
	 	    }
	 	   //,bindAction: '#test-upload-change-action'
	 	   ,before: function(obj){
	 	   //返回的参数item，即为当前的input DOM对象
	 	     layer.load(); //上传loading
	 	       console.log('文件上传中');
	 	 
	 	     //预读本地文件示例，不支持ie8
	 	     obj.preview(function(index, file, result){
	 	       $('#s_image_demo').attr('src', result); //图片链接（base64）
	 	     });
	 	 
	 	   }
	 	   ,done: function(res){
	 	     console.log("返回码 : "+res.code);
	 		
	  		 //如果上传失败
	 	      if(res.code != 200){
	 	        return layer.msg('上传失败');
	 	      }
	 	     layer.closeAll();
	 	     layer.msg("上传成功");
	 	      //上传成功
	 	      $("#s_image").val(res.file_url);
	 		
	 	   },error: function(){
		      //演示失败状态，并实现重传
		      var demoText = $('#s_image_demoText');
		      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
		      demoText.find('.demo-reload').on('click', function(){
		        uploadInst.upload();
		      });
		    }

	});
	
	
	 /* 海报单图  */
	 upload.render({
		    elem: '#logo_btn'
	 	   ,url: '<%=request.getContextPath()%>/uploadToQiNiu.do'
	 	   ,auto:true
	 	,size: 1024//限制文件大小，单位 KB
	 	   ,exts: 'jpg|png'
	 	   ,xhr:xhrOnProgress
	 	   ,progress:function(value){//上传进度回调 value进度值
	 	     console.log(value);
	 	     element.progress('demo', value+'%')//设置页面进度条
	 	    }
	 	   //,bindAction: '#test-upload-change-action'
	 	   ,before: function(obj){
	 	   //返回的参数item，即为当前的input DOM对象
	 	     layer.load(); //上传loading
	 	       console.log('文件上传中');
	 	 
	 	     //预读本地文件示例，不支持ie8
	 	     obj.preview(function(index, file, result){
	 	       $('#logo_demo').attr('src', result); //图片链接（base64）
	 	     });
	 	 
	 	   }
	 	   ,done: function(res){
	 	     console.log("返回码 : "+res.code);
	 		
	  		 //如果上传失败
	 	      if(res.code != 200){
	 	        return layer.msg('上传失败');
	 	      }
	 	     layer.closeAll();
	 	     layer.msg("上传成功");
	 	      //上传成功
	 	      $("#logo").val(res.file_url);
	 		
	 	   },error: function(){
		      //演示失败状态，并实现重传
		      var demoText = $('#logo_demoText');
		      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
		      demoText.find('.demo-reload').on('click', function(){
		        uploadInst.upload();
		      });
		    }

	});
	

	 /* 分享单图  */
	 upload.render({
		    elem: '#wepro_qrcode_image_btn'
	 	   ,url: '<%=request.getContextPath()%>/uploadToQiNiu.do'
	 	   ,auto:true
	 	,size: 1024//限制文件大小，单位 KB
	 	   ,exts: 'jpg|png'
	 	   ,xhr:xhrOnProgress
	 	   ,progress:function(value){//上传进度回调 value进度值
	 	     console.log(value);
	 	     element.progress('demo', value+'%')//设置页面进度条
	 	    }
	 	   //,bindAction: '#test-upload-change-action'
	 	   ,before: function(obj){
	 	   //返回的参数item，即为当前的input DOM对象
	 	     layer.load(); //上传loading
	 	       console.log('文件上传中');
	 	 
	 	     //预读本地文件示例，不支持ie8
	 	     obj.preview(function(index, file, result){
	 	       $('#wepro_qrcode_image_demo').attr('src', result); //图片链接（base64）
	 	     });
	 	 
	 	   }
	 	   ,done: function(res){
	 	     console.log("返回码 : "+res.code);
	 		
	  		 //如果上传失败
	 	      if(res.code != 200){
	 	        return layer.msg('上传失败');
	 	      }
	 	     layer.closeAll();
	 	     layer.msg("上传成功");
	 	      //上传成功
	 	      $("#wepro_qrcode_image").val(res.file_url);
	 		
	 	   },error: function(){
		      //演示失败状态，并实现重传
		      var demoText = $('#wepro_qrcode_image_demoText');
		      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
		      demoText.find('.demo-reload').on('click', function(){
		        uploadInst.upload();
		      });
		    }

	});
	
	
	
	
});


$(document).on("mouseenter mouseleave", ".file-iteme", function(event){
    if(event.type === "mouseenter"){
        //鼠标悬浮
        $(this).children(".info").fadeIn("fast");
        $(this).children(".handle").fadeIn("fast");
    }else if(event.type === "mouseleave") {
        //鼠标离开
        $(this).children(".info").hide();
        $(this).children(".handle").hide();
    }
});

//删除图片
$(document).on("click", ".file-iteme .handle", function(event){
    
    var  $this = $(this).parent();   //  习惯性保存下当前标签
    var index = $this.index();
    console.info( index );
    
    
    $(this).parent().remove();
	  console.log(images);
  //获取下标
	//var subscript=$("#uploader-list img").index($(this));  
	//console.log("下标  :  "+subscript);
	//删除数组
	images.splice(index, 1);
	//重新排序
	//images.sort();
    console.log(images);
    
});


</script>   
<!-- 图片上传可视化用 -->
<script type="text/javascript">
//该部分代码主要使用ajax的xhr属性，我copy别人的，自己也不会写，应该不用管。

   var xhrOnProgress=function(fun) {
      xhrOnProgress.onprogress = fun; //绑定监听
       //使用闭包实现监听绑
      return function() {
          //通过$.ajaxSettings.xhr();获得XMLHttpRequest对象
          var xhr = $.ajaxSettings.xhr();
           //判断监听函数是否为函数
            if (typeof xhrOnProgress.onprogress !== 'function')
                 return xhr;
             //如果有监听函数并且xhr对象支持绑定时就把监听函数绑定上去
              if (xhrOnProgress.onprogress && xhr.upload) {
                    xhr.upload.onprogress = xhrOnProgress.onprogress;
              }
              return xhr;
       }
   };

// 图片弹出层
layui.use('layer', function(){
    $ = layui.jquery;//jquery
  layer = layui.layer;//弹出层

  //以上模块根据需要引入
	//轮播图弹出
    layer.ready(function(){ //为了layer.ext.js加载完毕再执行
      layer.photos({
        photos: '#x-img'
        //,shift: 5 //0-6的选择，指定弹出图片动画类型，默认随机
      });
    });

}); 
</script>  
<!-- ue初始化 -->
<script type="text/javascript">
	/* var ue = UE.getEditor('editor',{
		autoFloatEnabled:true,//浮动
		toolbars: [[
    		'source','bold', 'italic',  'removeformat', 'formatmatch', 'autotypeset','selectall', 'cleardoc', 
           'lineheight', '|','fontfamily', 'fontsize', 'forecolor', 'backcolor','|',
            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|','insertimage', 'emotion', 
        ]]
	});
	 */
	/* var ue2 = UE.getEditor('editor_pz',{
		autoFloatEnabled:true,//浮动
		toolbars: [[
    		'source','bold', 'italic',  'removeformat', 'formatmatch', 'autotypeset','selectall', 'cleardoc', 
           'lineheight', '|','fontfamily', 'fontsize', 'forecolor', 'backcolor','|',
            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|','insertimage', 'emotion', 
        ]]
	}); */
	
</script> 
			<!-- ue初始化 -->
<!-- <script type="text/javascript">
	var ue = UE.getEditor('editor1',{
		toolbars: [[
    		'source','bold', 'italic',  'removeformat', 'formatmatch', 'autotypeset','selectall', 'cleardoc', 
           'lineheight', '|','fontfamily', 'fontsize', 'forecolor', 'backcolor','|',
            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|','insertimage', 'emotion', 'insertvideo'
        ]]
    });
</script>  -->  

<script>
layui.use(['table', 'util'], function(){
  var table = layui.table
  ,util = layui.util;
  
  //监听单元格编辑
  table.on('edit(test3)', function(obj){
    var value = obj.value //得到修改后的值
    ,data = obj.data //得到所在行所有键值
    ,field = obj.field; //得到字段
   
    //layer.msg('[ID: '+ data.f_id +'] ' + field + ' 字段更改值为：'+ util.escape(value));
  });
  
//获取行数据  
  $('#ttes').click(function () {
        var checkStatus = table.checkStatus('tttttable');
        console.log(checkStatus.data);//选中行数据
        tableData = checkStatus.data;
        //console.log("xaunzhong de  : "+tableData);
  });
  
  
  table.render({
    elem: '#tttttable'
        , url: "<c:url value='/findAllFairAndUserJson.do'/>?u_id=${userDetails.u_id}"
        , title: '会议列表'
        , page: false //开启分页
        , cols: [[
            {type:'checkbox'}
            , {field: 'f_id', width:80, title: '会议ID'}
            , {field: 'f_title', width:400, title: '会议名称'}
            , {field: 'si_zc', edit: 'text', width:150, title: '会议座次'}
        ]]
        ,done: function(res, page, count){
            //可以自行添加判断的条件是否选中
            //这句才是真正选中，通过设置关键字LAY_CHECKED为true选中，这里只对第一行选中
            //res.data[0]["LAY_CHECKED"]='true';
            //下面三句是通过更改css来实现选中的效果
            //var index= res.data[0]['LAY_TABLE_INDEX'];
            //$('tr[data-index=' + index + '] input[type="checkbox"]').prop('checked', true);
            //$('tr[data-index=' + index + '] input[type="checkbox"]').next().addClass('layui-form-checked');
           
            var userBindFairStr = "${userBindFairStr}"; 
            
            var sss= userBindFairStr.split(',');
           // console.log("sss . "+sss.length);
            
			for(var i=0;i<res.data.length;i++){
				//console.log("res.data"+res.data[i].f_id);
	        	 for(var j=0;j<sss.length;j++){
	        		// console.log("sss data  "+sss[j]);
	        		var f_id = sss[j];
	        		//console.log("f_id : "+f_id +"   res.data[i].f_id : "+res.data[i].f_id);
	        		if(f_id == res.data[i].f_id){
	        			//console.log("相等");
	        			res.data[i]["LAY_CHECKED"]='true';
	        			var index= res.data[i]['LAY_TABLE_INDEX'];
	                    $('tr[data-index=' + index + '] input[type="checkbox"]').prop('checked', true);
	                    $('tr[data-index=' + index + '] input[type="checkbox"]').next().addClass('layui-form-checked');
	        		}
	        	} 
			}
        
        }

	});
});



</script> 
<script type="text/html" id="isZC">

	for(var i=0;i<userBindFair.length;i++){
		var f_id = userBindFair[i].f_id;
		if(f_id == {{d._id}}){
			console.log("相等");
			checked
		}
	}
</script>      
  </body>
</html>